//输入框长度大于0显示X
$a('.input5').forEach(function(v, i) {
    // console.log(v, i);
    v.addEventListener('input', function() {
        if (v.value.length > 0) {
            $a('.cha1')[i].style.display = 'block'
        } else {
            $a('.cha1')[i].style.display = 'none'
        }

    })
})

//点击X清除输入框内容  并隐藏自己
$a('.cha1').forEach(function(v, i) {
    // console.log(v, i);
    v.addEventListener('click', function() {
        // console.log(1);
        $a('.input5')[i].value = ''
        this.style.display = 'none'
        $a('.registerx')[i].style.display = 'none'
    })

})


//定义验证规则
let reg = [/^[a-zA-Z][a-zA-Z0-9]{5,19}$/,
        /^1[3-9]\d{9}$/,
        /^\d{4}$/,
        /^\w{6,12}$/

    ]
    //验证
$a('.input5').forEach(function(v, i) {
        // console.log(v);
        v.addEventListener('blur', function() {
            // console.log(1);
            if (reg[i].test(v.value)) {
                $a('.registerx')[i].style.display = 'none'
            } else {
                $a('.registerx')[i].style.display = 'block'


            }

        })


    })
    // 禁用

$('.input10').addEventListener('change', function() {
        $('.input3').disabled = !this.checked
            // console.log(this.checked);

        if (this.checked) {
            $('.input3').style.background = '#00bdff'
        } else {
            $('.input3').style.background = ''
        }

    })
    //提交
$('.input3').addEventListener('click', function() {
    $a('.input5').forEach(function(v, i) {
        // console.log(v);

        // console.log(1);
        if (reg[i].test(v.value)) {
            $a('.registerx')[i].style.display = 'none'
        } else {
            $a('.registerx')[i].style.display = 'block'


        }




    })
})